import Vue from 'vue'
import Router from 'vue-router'
import BkSysEmpLogin from '@/page/login/BkSysEmpLogin.vue'
import BkSysEmpIndex from '@/page/index/BkSysEmpIndex.vue'
import commonServiceModule from '@/components/commonServiceModule.vue'
import commonService from './commonService.js'
import manageServiceModule from '@/components/manageServiceModule.vue'
import manageService from './manageService.js'
import loanServiceModule from '@/components/loanServiceModule.vue'
import loanService from './loanService.js'

Vue.use(Router)
//页面刷新时，重新赋值token
// if (sessionStorage.getItem('token')) {
//   store.commit('set_token', sessionStorage.getItem('token'))
// }
export default new Router({
  mode: 'history',  //去掉url中的#
  routes: [
    {
      path: '/',
      redirect: '/login',
    },
    {
      path: '/login',
      name: 'BkSysEmpLogin',
      component: BkSysEmpLogin,
    },
    {
      path: '/index',
      name: 'BkSysEmpIndex',
      component: BkSysEmpIndex,
      meta: {requiresAuth: true }
    },
    {//普通柜员业务模块
      path: '/commonService',
      component: commonServiceModule,
      children: commonService,
      meta: {requiresAuth: true }
    },
    {//管理员模块
      path: '/manageService',
      component: manageServiceModule,
      children: manageService,
      meta: {requiresAuth: true }
    },
    {//贷款专员模块
      path: '/loanService',
      component: loanServiceModule,
      children: loanService,
      meta: {requiresAuth: true }
    }
  ]
});

